The bug found in the presentation that we forgot to review has been fixed
[RRRRHHHH_Code] / ruralHouses client / src / gui / OffersRelatedOwnerGUI.java
1 package gui;
2
3 import java.awt.Frame;
4 import java.awt.event.ActionEvent;
5 import java.awt.event.ActionListener;
6 import java.rmi.Naming;
7 import java.rmi.RemoteException;
8
9 import javax.swing.GroupLayout;
10 import javax.swing.GroupLayout.Alignment;
11 import javax.swing.JButton;
12 import javax.swing.JFrame;
13 import javax.swing.JPanel;
14 import javax.swing.border.EmptyBorder;
15
16 import common.HouseInterface;
17
18 import configuration.___IntNames;
19 import domain.Owner;
20
21 public class OffersRelatedOwnerGUI extends JFrame {
22
23         /**
24          * 
25          */
26         private static final long serialVersionUID = 1L;
27         private JPanel contentPane;
28         private Owner owner;
29         /**
30          * Create the frame.
31          */
32         public OffersRelatedOwnerGUI(Owner o) {
33                 this.getContentPane().setLayout(null);
34                 owner = o;
35                 setBounds(100, 100, 450, 562);
36                 contentPane = new JPanel();
37                 contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
38                 setContentPane(contentPane);
39                 
40                 JButton btnCreateOffers = new JButton("Create Offers");
41                 btnCreateOffers.addActionListener(new ActionListener() {
42                         public void actionPerformed(ActionEvent arg0) {
43                                 HouseInterface houseM=null;
44                                 try {
45                                         houseM = (HouseInterface) Naming
46                                                         .lookup(___IntNames.HouseManager);
47                                 } catch (Exception e1) {
48                                         System.out.println("Error accessing remote authentication: "
49                                                         + e1.toString());
50                                 }
51                                 Frame a = null;
52                                 try {
53                                         a = new AddOffersGUI(houseM.getHouses(owner, null, null, 0, 0, 0, 0, 0));
54                                 } catch (RemoteException e) {
55                                         // TODO Auto-generated catch block
56                                         e.printStackTrace();
57                                 }
58                                 a.setVisible(true);
59                         }
60                 });
61                 
62                 JButton btnModifyOffers = new JButton("Modify Offers");
63                 btnModifyOffers.addActionListener(new ActionListener() {
64                         public void actionPerformed(ActionEvent e) {
65                                 
66                                 Frame a = new ModifyOfferGUI(owner);
67                                 a.setVisible(true);
68                                 
69                         }
70                 });
71                 
72                 JButton btnDeleteOffers = new JButton("Delete Offers");
73                 btnDeleteOffers.addActionListener(new ActionListener() {
74                         public void actionPerformed(ActionEvent e) {
75                                 Frame a = new DeleteOfferGUI(owner);
76                                 a.setVisible(true);
77                         }
78                 });
79                 GroupLayout gl_contentPane = new GroupLayout(contentPane);
80                 gl_contentPane.setHorizontalGroup(
81                         gl_contentPane.createParallelGroup(Alignment.LEADING)
82                                 .addGroup(gl_contentPane.createSequentialGroup()
83                                         .addGap(110)
84                                         .addGroup(gl_contentPane.createParallelGroup(Alignment.TRAILING)
85                                                 .addComponent(btnDeleteOffers, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 1125, Short.MAX_VALUE)
86                                                 .addComponent(btnModifyOffers, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 1125, Short.MAX_VALUE)
87                                                 .addComponent(btnCreateOffers, GroupLayout.DEFAULT_SIZE, 1125, Short.MAX_VALUE))
88                                         .addGap(121))
89                 );
90                 gl_contentPane.setVerticalGroup(
91                         gl_contentPane.createParallelGroup(Alignment.LEADING)
92                                 .addGroup(gl_contentPane.createSequentialGroup()
93                                         .addGap(88)
94                                         .addComponent(btnCreateOffers, GroupLayout.PREFERRED_SIZE, 58, GroupLayout.PREFERRED_SIZE)
95                                         .addGap(40)
96                                         .addComponent(btnModifyOffers, GroupLayout.PREFERRED_SIZE, 57, GroupLayout.PREFERRED_SIZE)
97                                         .addGap(39)
98                                         .addComponent(btnDeleteOffers, GroupLayout.PREFERRED_SIZE, 54, GroupLayout.PREFERRED_SIZE)
99                                         .addContainerGap(394, Short.MAX_VALUE))
100                 );
101                 contentPane.setLayout(gl_contentPane);
102         }
103 }